/**
 * AnserApi.java
 * com.zhihu.zhihuquan.api
 * Copyright (c) 2016, 北京聚智未来科技有限公司版权所有.
*/

package com.zhihu.zhihuquan.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jfinal.core.Controller;
import com.zhihu.zhihuquan.model.Answer;

/**
 * 首页，知乎圈
 *
 * @author   wxl
 * @Date	 2016年12月23日 	 
 */
public class AnswerApi extends Controller {

	/**
	 * 查询
	 * 回答列表
	 */
	public Map<String, Object> queryAll() {
		Map<String, Object> map = new HashMap<String, Object>();
		List<Answer> querylist = Answer.dao.queryAll();
		map.put("querylist", querylist);
		setAttr("ds", querylist);
		render("/eova/widget/form/gameTask.html");
		renderJson(querylist);
		return map;
	}

	/**
	 * 查询
	 * 根据条件模糊查询
	 */
	public Map<String, Object> queryConditionList() {
		String text = getPara(0);
		Map<String, Object> map = new HashMap<String, Object>();
		List<Answer> conditionList = Answer.dao.queryConditionList(text);
		map.put("conditionList", conditionList);
		setAttr("ds", conditionList);
		render("/eova/widget/form/gameTask.html");
		renderJson(conditionList);
		return map;
	}
}
